package com.springboot.astra.service.serviceImpl;

import com.springboot.astra.bean.Shopcart;
import com.springboot.astra.mapper.ShopcartMapper;
import com.springboot.astra.service.ShopcartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ShopcartServiceImpl implements ShopcartService {
    @Autowired
    ShopcartMapper shopcartMapper;

    @Override
    public List<Shopcart> getAllByUserId(Integer id) {
        return shopcartMapper.getAllByUserId(id);
    }

    @Override
    public void insertOne(Shopcart shopcart) {
        shopcartMapper.insertOne(shopcart);
    }

    @Override
    public void updateOneById(Shopcart shopcart) {
        shopcartMapper.updateOneById(shopcart);
    }

    @Override
    public void deleteOneById(Integer id) {
        shopcartMapper.deleteOneById(id);
    }

    @Override
    public void deleteAllById(Integer userId) {
        shopcartMapper.deleteAllById(userId);
    }
}
